<?php

require_once './application/core/CoreBase.php';
require_once './application/models/Objets/Composant.php';
require_once './application/entity/config/confdifflist.php';

class listdiffConfig extends CoreBase
{

    private $_obj;
    private $_comp;
    private $_conf;
    private $_objList;

    public function getListAllConf()
    {
        $this->_obj = new ObjectComposant();
        $this->_comp = $this->_obj->rechercheListeComposant();
        $this->_objList = new confdiffList();
        $this->_objList->comp = false;
        $this->_objList->conf = false;
        foreach ($this->_comp as $key => $comp)
        {
            $this->_objList->comp[] = $comp['HostName'] . '-' . $comp['Ip'];
            $this->_conf = $this->_obj->rechercheConfiguration($comp['IdComposant']);
            foreach ($this->_conf as $key => $conf)
                $this->_objList->conf[] = array($comp['HostName'] => $conf['IdConfiguration'] . ";" . $conf['Date']);
        }
        echo Zend_Json_Encoder::encode($this->_objList);
    }

    public function cleanSessionBackup()
    {
        $cache = new cache();
        $cache->deleteAllInfoSessionService($this->_controller->_idClient, 'backupresp');
    }

}
